<template>
    <div>
        <!--  -->
        <i-select :label-in-value="true"  placeholder="一级分类" @on-change="selectOne">
            <i-option v-for="item in one_list" :value="item.label" v-bind:key="item.value">{{item.value}}</i-option>
        </i-select>
    </div>
</template>
<script>
    import configService from 'service/configService.js'
    export default {
        name: 'levelTools',
        props: {
        },
        data() {
            return {
                one_list:[]
            }
        },
        methods: {
            async getLevelOneList() {
                let jsondata = await configService.getQuestionTypeList()
                if (jsondata.children) {
                    jsondata.children.forEach((item, index) => {
                        item.value = item.attributes.serviceName;
                        item.label = item.attributes.serviceId;
                    })
                }
                this.one_list = jsondata.children;
                
            },
            selectOne(curropt) {
                this.$emit('getLevelOne',curropt);
            }
        },
        created(){
            this.getLevelOneList();
        }
    }
</script>